<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>layout 后台大布局 - Layui</title>
  <link rel="stylesheet" href="../layui/css/layui.css">
  <link rel="stylesheet" href="../css/global.css">
  <link rel="stylesheet" href="../icheck/minimal/red.css">
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
  <div class="layui-header">
    <div class="layui-logo">layui 后台布局</div>
    <!-- 头部区域（可配合layui已有的水平导航） -->
    <ul class="layui-nav layui-layout-left">
      <li class="layui-nav-item"><a href="capital.html">用户中心</a></li>
      <li class="layui-nav-item"><a href="../t.html" target="_Blank">接单</a></li>
    </ul>
    <ul class="layui-nav layui-layout-right">
     <li class="layui-nav-item" id="yongjin">佣金:</li>
	 <li class="layui-nav-item">
        <a href="javascript:;" id="username">
          <img src="http://t.cn/RCzsdCq" class="layui-nav-img" >
		  欢迎:
        </a>
        <dl class="layui-nav-child">
          <dd><a href="capital.html">基本资料</a></dd>
          <dd><a href="changepassword.html">修改密码</a></dd>
        </dl>
      </li>
      <li class="layui-nav-item"><a href="../login.html">退了</a></li>
    </ul>
  </div>
  
  <div class="layui-side layui-bg-black">
    <div class="layui-side-scroll">
      <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
      <ul class="layui-nav layui-nav-tree"  lay-filter="test">
        <li class="layui-nav-item"><a href="../index.html">控制台</a></li>
        
        <li class="layui-nav-item layui-nav-itemed">
          <a href="javascript:;">用户管理</a>
          <dl class="layui-nav-child">
            <dd><a class="layui-this" href="capital.html">用户中心</a></dd>
			<dd><a class="layui-this" href="tixian.html">提现</a></dd>
          </dl>
        </li>
       
        <li class="layui-nav-item">
                <a href="javascript:;">种菜区</a>
                <dl class="layui-nav-child">
                    <dd><a href="../t.html" target="_Blank">种菜</a></dd>
					<dd><a href="../foodmenulist/foodmenuList.html">菜谱</a></dd>
					
					
                </dl>
            </li>
        
        
      </ul>
    </div>
  </div>
  
   <div class="layui-body">
    <!-- 内容主体区域 -->
    <div style="padding: 15px;">
        <fieldset class="layui-elem-field">
            <legend>提现记录</legend>
		
        </fieldset>
            <div class="layui-field-box">
              
                <div class="layui-form-item" style="text-align:center;">
                  <div class="layui-inline">
                    <div class="layui-input-inline">
                      <input autocomplete="off" class="layui-input" placeholder="请输入提现金额" type="text" name="jine" id="jine" value="">
                    </div>
                  </div>
                  <div class="layui-inline" style="text-align:left;">
                    <div class="layui-input-inline">
                      <button data-method="offset" data-type="auto" class="layui-btn layui-btn-normal" id="tixian"></i>提现</button>
                    </div>
					<div class="layui-input-inline">
                      <button data-method="offset" data-type="auto" class="layui-btn layui-btn-normal" id="tianjia_wangyin">添加网银信息</button>
                    </div>
                  </div>
                </div>
               
			
				<div class="layui-tab">
					<ul class="layui-tab-title">
						<li class="layui-this">已提现</li>
						<li>转账中</li>
						
					</ul>
					<div class="layui-tab-content">
						<div class="layui-tab-item layui-show">
							 <table class="layui-table" id="yitixian" lay-filter="yitixian">
							 </table>
						</div>
						<div class="layui-tab-item">
							<table class="layui-table" id="zhuanzhangzhong" lay-filter="zhuanzhangzhong">
							</table>
						</div>
						
					</div>
				</div>
			
			  <!--操作-->
			<script type="text/html" id="renwuListBar">
				<a class="layui-btn layui-btn-xs" lay-event="Submit">提交完成</a>
				<!--<a class="layui-btn layui-btn-xs layui-btn-warm" lay-event="usable">已启用</a>-->
				<!--<a class="layui-btn layui-btn-xs layui-btn-warm" lay-event="detail">查看</a>-->
				<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="cancel">取消任务</a>
			</script>
			<script type="text/html" id="weishenhe">
				<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="weishenhe">未审核</a>
			</script>
            </div>
			
		
    </div>
	
	
	
  </div>
  
  <div class="layui-footer" id="bottom">
    
  </div>
</div>
<script type="text/javascript" src="../javascript/jquery.min.js"></script>
<script type="text/javascript" src="../layui/layui.js"></script>
<script type="text/javascript" src="../icheck/icheck.js"></script>
<script type="text/javascript" src="../javascript/dw.js"></script>
<script type="text/javascript" src="tixian.js"></script>
<script>
	layui.use(['form','layer','jquery'],function(){
	name="";
	kahao="";
	kaihuhang="";
	
	$("#bottom").load("bottom.html");
	
	
		var form = layui.form,
			layer = parent.layer === undefined ? layui.layer : top.layer
			$ = layui.jquery;
			console.log(localStorage.login_font_name);
			if(!localStorage.login_font_name||localStorage.login_font_name==''){
			//layer.msg("您还未登录，请先登录后操作")
			
				setTimeout(function(){
					layer.msg("您还未登录,请前往登录");
					window.location.href = "http://127.0.0.1:89/font/login.html";
				},2000);
			}else{
				console.log(localStorage.login_font_name);
				//$("#user_name").append(localStorage.login_name);
				$("#username").append(localStorage.login_font_name);
				$("#yongjin").append(localStorage.login_font_yongjin);
			}
			
		$("#tixian").click(function() {
			$.ajax({ //结束时间
				type: 'POST',
				async:false,
				url: "http://127.0.0.1:88/index.php/font/Font/getkahaoinformation",
				dataType: "json",
				data: "user_name="+localStorage.login_font_name,
				success: function(sss) {
					console.log(sss);
					name=sss['data'][0]['name'];
					kahao=sss['data'][0]['yinhangkahao'];
					kaihuhang=sss['data'][0]['kaihuhang'];
				}
			});
			console.log(name);
			var anniu=[ '确认','取消'];
			var kaichuang=layer.open({
				type: 1,
				closeBtn: 0,
				content: '<fieldset class="layui-elem-field site-demo-button">'+'<legend><big><b id="information">提现</b></big></legend>'+
				'<form class="layui-form layui-form-pane" action="">'+
				'<div id="wangyin" class="layui-fluid layui-form layui-form-pane">'+
							'<div class="layui-form-item">'+
							'<label class="layui-form-label">提现金额</label>'+
							'<div class="layui-input-inline">'+
								'<input class="layui-input" id="tixian_jin_er" type="text" value="'+$("#jine").val()+'"/>'+
							'</div>'+
							'</div>'+
							'<div class="layui-form-item">'+
							'<label class="layui-form-label">姓名</label>'+
							'<div class="layui-input-inline">'+
								'<input class="layui-input" id="name" type="text" value="'+name+'" readonly="true"/>'+
							'</div>'+
							'</div>'+
				
							'<div class="layui-form-item">'+
							'<label class="layui-form-label">卡号</label>'+
							'<div class="layui-input-inline">'+
								'<input class="layui-input" id="yinhangkahao" type="text" value="'+kahao+'" readonly="true"/>'+
							'</div>'+
							'</div>'+
							
							'<div class="layui-form-item">'+
							'<label class="layui-form-label">开户行</label>'+
							'<div class="layui-input-inline">'+
								'<input class="layui-input" id="kaihuhang" type="text" value="'+kaihuhang+'" readonly="true"/>'+
							'</div>'+
							'</div>'+
							
						'</div></form></fieldset>',
				btn:anniu,
				yes: function() {
					if(name&&kahao){
					
						if($("#name").val()!=''&&$("#yinhangkahao").val()!=''){
					
							$.ajax({ //结束时间
								type: 'POST',
								url: "http://127.0.0.1:88/index.php/font/Font/tixian",
								dataType: "json",
								data: "name="+$("#name").val()+"&yinhangkahao="+$("#yinhangkahao").val()+"&user_name="+localStorage.login_font_name+"&kaihuhang="+$("#kaihuhang").val()+"&tixian_jin_er="+$("#tixian_jin_er").val(),
								success: function(sss) {
									layer.msg(sss['msg']);
									
								}
							});
						}
					}else{
						layer.msg("请先添加银行卡信息");
					}
					layer.close(kaichuang);
					
					return false;
				},
				btn2: function() {
					
					$("#password").val('');
					layer.close(kaichuang);
					
					return true;
				}
			}); 
		})

		
		
		
		$("#tianjia_wangyin").click(function() {
			$.ajax({ //结束时间
				type: 'POST',
				async:false,
				url: "http://127.0.0.1:88/index.php/font/Font/getkahaoinformation",
				dataType: "json",
				data: "user_name="+localStorage.login_font_name,
				success: function(sss) {
					console.log(sss);
					name=sss['data'][0]['name'];
					kahao=sss['data'][0]['yinhangkahao'];
					kaihuhang=sss['data'][0]['kaihuhang'];
				}
			});
			console.log(name);
			var anniu="";
			if (name!='null' && name!='' ){
				anniu=['您已添加过银行卡点击修改','取消'];
				
			}
			else{
				anniu=[ '确认','取消'];
			}
			
			var kaichuang=layer.open({
				type: 1,
				closeBtn: 0,
				content: '<fieldset class="layui-elem-field site-demo-button">'+'<legend><big><b id="information">个人信息</b></big></legend>'+
				'<form class="layui-form layui-form-pane" action="">'+
				'<div id="wangyin" class="layui-fluid layui-form layui-form-pane">'+
							'<div class="layui-form-item">'+
							'<label class="layui-form-label">姓名</label>'+
							'<div class="layui-input-inline">'+
								'<input class="layui-input" id="name" type="text" value="'+name+'"/>'+
							'</div>'+
							'</div>'+
							
							
							'<div class="layui-form-item">'+
							'<label class="layui-form-label">卡号</label>'+
							'<div class="layui-input-inline">'+
								'<input class="layui-input" id="yinhangkahao" type="text" value="'+kahao+'"/>'+
							'</div>'+
							'</div>'+
							
							'<div class="layui-form-item">'+
							'<label class="layui-form-label">开户行</label>'+
							'<div class="layui-input-inline">'+
								'<input class="layui-input" id="kaihuhang" type="text" value="'+kaihuhang+'"/>'+
							'</div>'+
							'</div>'+
							
						'</div></form></fieldset>',
				btn:anniu,
				yes: function() {
				
				
					$.ajax({ //结束时间
						type: 'POST',
						url: "http://127.0.0.1:88/index.php/font/Font/tianjiakahao",
						dataType: "json",
						data: "name="+$("#name").val()+"&yinhangkahao="+$("#yinhangkahao").val()+"&user_name="+localStorage.login_font_name+"&kaihuhang="+$("#kaihuhang").val(),
						success: function(sss) {
							layer.msg(sss['msg']);
							
						}
					});
					layer.close(kaichuang);
					
					return false;
				},
				btn2: function() {
					
					$("#password").val('');
					layer.close(kaichuang);
					
					return true;
				}
			}); 
			
			$("#name").blur(function(){
				
				
				var str = $("#name").val();
				var result =  /^[\u4e00-\u9fa5\u4dae\uE863]+$/.test(str);
				if (!result){
					layer.msg('请输入正确的名字，名字必须全是中文');
					$("#name").focus();
				}
			});
			
			
			$("#yinhangkahao").blur(function(){
					var card = $("#yinhangkahao").val();
					$.ajax({
						type:"get",
						url:"https://ccdcapi.alipay.com/validateAndCacheCardInfo.json?cardNo="+card+"&cardBinCheck=true",
						dataType:"json",
						success:function(data){
							
							if(data.messages.length){
								layer.msg("您输入的卡号有误，请重新输入");
								$("#yinhangkahao").focus();
							}else{
								var bank = data.bank;
								
								$.ajax({
									type:"get",
									url:"../../json/bank.json",
									datatype:"json",
									success:function(obj){
									console.log(obj[bank]);
										$("#kaihuhang").val(obj[bank]);
									}
								});
							}
							
						}
					});
				});
		})
	})

</script>

</body>
</html>